Vue.component('yl-button', {
    template: `
    <span>
        <el-button :type="type" @click="Export" :loading="loading">
            <slot></slot>
        </el-button>
        <el-table id="ExportData" :data="data" style="display: none; width: 100%;margin-bottom: 20px;">
        <el-table-column align="center" type="index" label="序号" width="50"></el-table-column>
        <el-table-column align="center" prop="Sales_Order_SerialNumber" label="订单编号"></el-table-column>
        <el-table-column align="center" prop="Sales_Amount" label="订单金额"></el-table-column>
        <el-table-column align="center" prop="Points_Amount" label="订单积分"></el-table-column>
        <el-table-column align="center" prop="Member_Name" label="用户姓名"></el-table-column>
        <el-table-column align="center" prop="Sales_Contacts" label="收件人"></el-table-column>
        <el-table-column align="center" prop="Sales_Phone" label="联系方式"></el-table-column>
        <el-table-column align="center" prop="Sales_Address" label="收货地址"></el-table-column>
        <el-table-column align="center" prop="Sales_Date" label="下单时间"></el-table-column>
        <el-table-column align="center" prop="Row_Status" label="订单状态">
            <template v-slot="{row}">
                {{row.Row_Status=='0'?'待付款':row.Row_Status=='1'?'已作废':row.Row_Status=='2'?'已付款':''}}
            </template>
        </el-table-column>
        </el-table>
    </span>`,
    props: ['loading', 'data', 'type'],
    methods: {
        Export() {
            this.$emit('click')
        }
    }
})
Vue.component('show-detail1', {
    template: `<el-dialog title="售后详情" id="order" :visible.sync="visibleDialog" width="80vw">
        <div class="table_titel">
            <div class="titel">订单信息 <span style="color:red;">({{Row_Status(data.Row_Status)}})</span></div>
        </div>
        <el-descriptions style="width:100%" :column="3" border size="small">
            <el-descriptions-item label="订单明细编号">
                <el-tooltip class="item" effect="dark" :content="data.Sales_Order_Detail_SerialNumber" placement="top-start">
                    <el-input :value="data.Sales_Order_Detail_SerialNumber" :disabled="true"></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="售后订单号">
                <el-tooltip class="item" effect="dark" :content="data.Refund_SerialNumber" placement="top-start">
                    <el-input :value="data.Refund_SerialNumber" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="订单编号">
                <el-tooltip class="item" effect="dark" :content="data.Sales_Order_SerialNumber" placement="top-start">
                    <el-input :value="data.Sales_Order_SerialNumber" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="支付时间">
                <el-tooltip class="item" effect="dark" :content="getYMDHMSDate(data.Collection_Date)" placement="top-start">
                    <el-input :value="getYMDHMSDate(data.Collection_Date)" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="支付方式">
                <el-tooltip class="item" effect="dark" :content="data.Collection_Type" placement="top-start">
                    <el-input :value="data.Collection_Type" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="订单总金额">
                <el-tooltip class="item" effect="dark" :content="data.Sales_Amount+'元'" placement="top-start">
                    <el-input :value="data.Sales_Amount+'元'" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="供应商名称">
                <el-tooltip class="item" effect="dark" :content="data.Supplier_Name" placement="top-start">
                    <el-input :value="data.Supplier_Name" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="发货状态">
                <el-tooltip class="item" effect="dark" :content="Detail_Status(data.Sales_Order_Detail_Status)" placement="top-start">
                    <el-input :value="Detail_Status(data.Sales_Order_Detail_Status)" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="物流信息">
                <el-tooltip class="item" effect="dark" :content="data.Sales_Order_Logistics_Number?data.Sales_Order_Logistics_Number:'暂未发货'" placement="top-start">
                    <el-input :value="data.Sales_Order_Logistics_Number?data.Sales_Order_Logistics_Number:'暂未发货'" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="退货物流单号">
                <el-tooltip class="item" effect="dark" :content="data.Logistics_Number?data.Logistics_Number:'暂无退货物流单号'" placement="top-start">
                    <el-input :value="data.Logistics_Number?data.Logistics_Number:'暂无退货物流单号'" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="售后类型">
                <el-tooltip class="item" effect="dark" :content="Refund_Type(data.Refund_Type)" placement="top-start">
                    <el-input :value="Refund_Type(data.Refund_Type)" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="买家账户">
                <el-tooltip class="item" effect="dark" :content="data.Member_Name" placement="top-start">
                    <el-input :value="data.Member_Name" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="申请时间">
                <el-tooltip class="item" effect="dark" :content="getYMDHMSDate(data.Submit_Date)" placement="top-start">
                    <el-input :value="getYMDHMSDate(data.Submit_Date)" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="下单时间">
                <el-tooltip class="item" effect="dark" :content="data.Sales_Date" placement="top-start">
                    <el-input :value="data.Sales_Date" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
            <el-descriptions-item label="退款原因">
                <el-tooltip class="item" effect="dark" :content="data.Refund_Cause" placement="top-start">
                    <el-input :value="data.Refund_Cause" disabled></el-input>
                </el-tooltip>
            </el-descriptions-item>
        </el-descriptions>
        <div class="table_titel">
            <div class="titel">售后商品</div>
        </div>
        <div style="display:flex;">
            <div style="width:170px;height:170px;border:1px solid #EBEEF5;flex-shrink:0;display: flex;justify-content: center; align-items: center;">
                <el-image style="width:150px;height:150px;border-radius: 5px" :preview-src-list="[BASE_IMG+data.Picture_URL]" :src="BASE_IMG+data.Picture_URL">
                    <div slot="error" class="el-image__error">暂无商品图片</div>
                </el-image>
            </div>
            <el-descriptions style="width:100%" :column="3" border size="small">
                <el-descriptions-item label="商品名称">
                    <el-tooltip class="item" effect="dark" :content="data.Article_Name" placement="top-start">
                        <el-input :value="data.Article_Name" disabled></el-input>
                    </el-tooltip>
                </el-descriptions-item>
                <el-descriptions-item label="商品规格">
                    <el-tooltip class="item" effect="dark" :content="data.Specifications_Name" placement="top-start">
                        <el-input :value="data.Specifications_Name" :disabled="true"></el-input>
                    </el-tooltip>
                </el-descriptions-item>
                <el-descriptions-item label="供应商品编码">
                    <el-tooltip class="item" effect="dark" :content="data.Supplier_Article_SerialNumber" placement="top-start">
                        <el-input :value="data.Supplier_Article_SerialNumber" :disabled="true"></el-input>
                    </el-tooltip>
                </el-descriptions-item>
                <el-descriptions-item label="单价">
                    <el-tooltip class="item" effect="dark" :content="data.Sales_Unit_Price+'元'" placement="top-start">
                        <el-input :value="data.Sales_Unit_Price+'元'" :disabled="true"></el-input>
                    </el-tooltip>
                </el-descriptions-item>
                <el-descriptions-item label="数量">
                    <el-tooltip class="item" effect="dark" :content="data.Quantity" placement="top-start">
                        <el-input :value="data.Quantity" :disabled="true"></el-input>
                    </el-tooltip>
                </el-descriptions-item>
                <el-descriptions-item label="总价">
                    <el-tooltip class="item" effect="dark" :content="data.Quantity?accMul(data.Quantity,data.Sales_Unit_Price)+'元':0" placement="top-start">
                        <el-input :value="data.Quantity?accMul(data.Quantity,data.Sales_Unit_Price)+'元':0" :disabled="true"></el-input>
                    </el-tooltip>    
                </el-descriptions-item>
                <el-descriptions-item label="实际总价">
                    <el-tooltip class="item" effect="dark" :content="data.Reality_Amount+'元'" placement="top-start">
                        <el-input :value="data.Reality_Amount+'元'" :disabled="true"></el-input>
                    </el-tooltip>    
                </el-descriptions-item>
                <el-descriptions-item label="消费积分">
                    <el-tooltip class="item" effect="dark" :content="data.Sales_Point" placement="top-start">
                        <el-input :value="data.Sales_Point" :disabled="true"></el-input>
                    </el-tooltip>
                </el-descriptions-item>
                <el-descriptions-item label="退款总金额">
                    <el-tooltip class="item" effect="dark" :content="Amount(data)" placement="top-start">
                        <el-input :value="Amount(data)" :disabled="true"></el-input>
                    </el-tooltip> 
                </el-descriptions-item>
            </el-descriptions>
        </div>
        <div class="table_titel">
            <div class="titel">协商历史</div>
        </div>
        <el-table :data="tableData" stripe border height="270px" style="width: 100%">
            <el-table-column align="center" type="index" label="序号" width="50"></el-table-column>
            <el-table-column align="center" show-overflow-tooltip prop="Sales_Order_SerialNumber" label="售后订单号"></el-table-column>
            <el-table-column align="center" show-overflow-tooltip prop="Quantity" label="售后类型">
                <template v-slot="{row}">
                    {{Refund_Type(row.Row_Status)}}
                </template>
            </el-table-column>
            <el-table-column align="center" show-overflow-tooltip prop="Refund_Message" label="买家留言"></el-table-column>
            <el-table-column align="center" show-overflow-tooltip prop="Refund_Cause" label="原因"></el-table-column>
            <el-table-column align="center" show-overflow-tooltip prop="Article_Name" label="退款商品"></el-table-column>
            <el-table-column align="center" show-overflow-tooltip label="退款总金额">
                <template v-slot="{row}">
                    {{Amount(row)}}
                </template>
            </el-table-column>
            <el-table-column align="center" show-overflow-tooltip prop="Submit_Date" min-width="160" label="申请时间">
                <template v-slot="{row}">
                    {{getYMDHMSDate(row.Submit_Date)}}
                </template>
            </el-table-column>
            <el-table-column align="center" show-overflow-tooltip label="状态">
                <template v-slot="{row}">
                   {{Row_Status(row.Row_Status)}}
                </template>
            </el-table-column>        
        </el-table>
        <el-pagination style="margin-top: 5px;" background @size-change="handleSizeChange"
            @current-change="handleCurrentChange" :current-page="form.page" :page-sizes="[10 ,20, 30, 50]"
            :page-size="form.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>
        <span slot="footer" class="dialog-footer">
            <el-button @click="$emit('update:visible',false)">取消</el-button>
            <template v-if="data.Refund_Type&&data.Refund_Type.charAt(1)=='0'&&data.Row_Status.charAt(1)!='3'&&data.Row_Status.charAt(1)!='4'&&data.Row_Status.charAt(1)!='6'">
                <el-button type="danger" @click="handle('false')">拒绝</el-button>
                <el-button type="success" @click="handle('true')">同意</el-button>
            </template>
            <el-button type="warning" v-else-if="data.Row_Status&&data.Row_Status.charAt(1)=='4'" @click="handle('return')">确认已退货</el-button>
        </span>
    </el-dialog>`,
    props: ['data', 'visible'],
    data() {
        return {
            visibleDialog: false,
            tableData: [],
            form: {
                SQLSerialNumber: "P_business_refund_detail",
                Condition: '',
                ExtensionCondition: '',
                PaginationNumber: 1,//页数
                RowAmount: 20,//每页数据条数
            },
            total: 0,
        }
    },
    computed: {
        Amount() {
            return function (row) {
                let Sales_Point = row.Sales_Point == 0 ? '' : row.Sales_Point + '积分';
                let i = row.Sales_Point != 0 && row.Reality_Amount != 0 ? '+' : ''
                let Reality_Amount = row.Reality_Amount == 0 ? '' : row.Reality_Amount + '元'
                return Sales_Point + i + Reality_Amount
            }
        },
        Refund_Type(){
            return function (str) {
                try {
                    str = str.charAt(0);
                } catch (error) {
                    return ""
                }
                switch (str) {
                    case "0":
                        return "仅退款";
                    case "1":
                        return "退货退款";
                    case "2":
                        return "换货";
                    default:
                        return ""
                }
            } 
        },
        Row_Status(){
            return function (str) {
                switch (str.charAt(1)) {
                    case "0":
                        return "待处理";
                    case "1":
                        return "已退款";
                    case "2":
                        return "已拒绝";
                    case "3":
                        return "待上传物流单号";
                    case "4":
                        return "退货中";
                    case "5":
                        return "已退货待处理退款";
                    case "6":
                        return "退货完成拒绝退款";
                    default:
                        return ""
                }
            }
        },
        Detail_Status(){
            return function(str){
                switch (str) {
                    case "0":
                        return "待发货";
                    case "1":
                        return "发货中";
                    case "2":
                        return "已发货";
                    default:
                        return ""
                }
            }
        }
    },
    watch: {
        visible() {
            this.visibleDialog = this.visible
        },
        visibleDialog(val) {
            this.$emit('update:visible', val)
            if (val) {
                let sql = "AND business_sales_order.Open_ID='"+this.data.Open_ID+"'\r\n"
                this.form.Condition = window.btoa(unescape(encodeURIComponent("%%,%%")));
                this.form.ExtensionCondition = window.btoa(unescape(encodeURIComponent(sql)));
                this.getList(this.form);
            }
        },
    },
    methods: {
        getList(data) {
            const that = this;
            $.ajax({
                headers: requestHeaders(),
                url: `${BASE_URL2}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
                type: 'POST',
                data,
                success: function (res) {
                    console.log(res);
                    that.tableData = res.Rows
                    that.total = res.TotalRows;
                },
                complete: function (XMLHttpRequest) {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json"
            });
        },
        handleSizeChange(val, id) {
            this.form.PaginationNumber = 1;
            this.form.RowAmount = val;
            this.getList(this.form)
        },
        handleCurrentChange(val, id) {
            this.form.PaginationNumber = val;
            this.getList(this.form)
        },
        handle(val){
            this.$emit('callback',val,this.data);
        }
    }
})
new Vue({
    el: '#app',
    data() {
        return {
            form: {
                SQLSerialNumber: "P_business_refund_detail",
                PaginationNumber: 1,//页数
                RowAmount: 20,//每页数据条数
                Condition: '',
                ExtensionCondition: '',
                Supplier_SerialNumber: '',
                Sales_Order_SerialNumber: '',
                Submit_Date: null,
            },
            Supplier: [],
            total: 0,
            tableData: [],	//表格数据
            treeData: [],
            ExportData: [],//导出
            defaultProps: {
                children: 'Children',
                label: 'Brand_Name'
            },
            loading: false,
            dialogVisible: false,
            dialogVisible1: false,
            Sales_Order: {},//当前选中的订单
        }
    },
    mounted() {
        this.dialogVisible1 = true;
        this.getData();
        this.getList(this.form);//前端分页
    },
    computed: {
        Type() {
            return function (str) {
                switch (str) {
                    case "Cash":
                        return "现金积分";
                    case "Activit":
                        return "活动积分";
                    case "Gift":
                        return "赠送积分";
                    case "Sales":
                        return "消费积分";
                    default:
                        return ""
                }
            }
        },
        Row_Status(){
            return function (str) {
                switch (str.charAt(1)) {
                    case "0":
                        return "待处理";
                    case "1":
                        return "已退款";
                    case "2":
                        return "已拒绝";
                    case "3":
                        return "待上传物流单号";
                    case "4":
                        return "退货中";
                    case "5":
                        return "已退货待处理退款";
                    case "6":
                        return "退货完成拒绝退款";
                    default:
                        return ""
                }
            }
        },
        Amount() {
            return function (row) {
                let Sales_Point = row.Sales_Point == 0 ? '' : row.Sales_Point + '积分';
                let i = row.Sales_Point != 0 && row.Reality_Amount != 0 ? '+' : ''
                let Reality_Amount = row.Reality_Amount == 0 ? '' : row.Reality_Amount + '元'
                return Sales_Point + i + Reality_Amount;
            }
        },
    },
    methods: {
        onSerach() {			//查询方法
            this.form.PaginationNumber = 1;
            this.getList(this.form)
        },
        handleSizeChange(val) {
            this.form.PaginationNumber = 1;
            this.form.RowAmount = val;
            this.getList(this.form)
        },
        handleCurrentChange(val) {
            this.form.PaginationNumber = val;
            this.getList(this.form)
        },
        getData() {
            const that = this;
            $.ajax({
                headers: requestHeaders(),
                url: `${BASE_URL2}/generalBusiness/generalQueryByTableName`,
                type: 'POST',
                data: {
                    Data: 'business_supplier_info',
                    Condition: "Row_Status <> '1'",
                },
                success: function (res) {
                    that.Supplier = res;
                },
                error: function () {
                    that.$message.error("操作失败，请稍后再试")
                },
                complete: function (XMLHttpRequest) {
                    that.loading = false
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json"
            });
        },
        getList(form) {//换页方法
            const that = this
            let data = deepClone(form);
            data.Condition = window.btoa(unescape(encodeURIComponent("%" + data.Sales_Order_SerialNumber + "%,%" + data.Sales_Order_SerialNumber + "%")))
            let sql = "";
            if (data.Submit_Date) {
                sql = sql + "AND business_refund_detail.Submit_Date BETWEEN '" + data.Submit_Date[0] + "' AND '" + data.Submit_Date[1] + "'\r\n"
            }
            if (data.Supplier_SerialNumber) {
                sql = sql + "AND business_sales_order_detail.Supplier_SerialNumber = '" + data.Supplier_SerialNumber + "'\r\n"
            }
            data.ExtensionCondition = window.btoa(unescape(encodeURIComponent(sql)));
            $.ajax({
                headers: requestHeaders(),
                url: `${BASE_URL2}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
                type: 'POST',
                data,
                success: function (Result) {
                    console.log(Result);
                    that.tableData = Result.Rows;
                    that.total = Result.TotalRows;
                },
                complete: function (XMLHttpRequest) {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json"
            });
        },
        callback(command,data){
            this.downloadTemplate(command,data);
        },
        downloadTemplate(command, row) {
            const that = this;
            if (command == "true") {
                this.$confirm('是否同意该退款申请?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                }).then(() => {
                    that.dialogVisible = false;
                    if (row.Refund_Type.charAt(0)=='0'||row.Row_Status.charAt(1)=='5') {//退款
                        $.ajax({
                            headers: requestHeaders(),
                            url: `${BASE_URL2}/collection/agreeRefund`,
                            type: 'POST',
                            data: {
                                RefundSerialNumber: row.Refund_SerialNumber,
                            },
                            success: function (Result) {
                                console.log(Result);
                                if (Result.Status == "success") {
                                    that.$message({
                                        type: 'success',
                                        message: Result.Description ? '电子支付发起退款申请完成，等待电子支付退款通知，' : '已同意退款'
                                    });
                                    that.dialogVisible = false;
                                    that.getList(that.form);
                                }
                            },
                            complete: function (XMLHttpRequest) {
                                requestPretreatment(XMLHttpRequest);
                            },
                            dataType: "json"
                        });
                    } else if(row.Refund_Type.charAt(0)=='1'){//退货退款，
                        $.ajax({//查询
                            headers: requestHeaders(),
                            url: `${BASE_URL2}/generalBusiness/generalQueryByTableNameWithOriginal`,
                            type: 'POST',
                            data: {
                                Data: "business_refund",
                                Condition: "Refund_SerialNumber='" + row.Refund_SerialNumber + "'"
                            },
                            success: function (business_refund) {
                                if (business_refund.length == 1) {
                                    let Row_Status = business_refund[0].Row_Status;
                                    business_refund[0].Row_Status = Row_Status.charAt(0) + '3';
                                    let data = {
                                        Data: JSON.stringify({ Modify: { business_refund } })
                                    }
                                    $.ajax({
                                        headers: requestHeaders(),
                                        url: `${BASE_URL2}/generalBusiness/generalSave`,
                                        type: 'POST',
                                        data,
                                        success: function (res) {
                                            if (res.Status == "success") {
                                                that.$message({
                                                    type: 'success',
                                                    message: '已同意审核,待对方上传物料信息'
                                                });
                                                that.dialogVisible = false;
                                                that.getList(that.form);
                                            }
                                        },
                                        complete: function (XMLHttpRequest) {
                                            requestPretreatment(XMLHttpRequest)
                                        },
                                        dataType: "json"
                                    })
                                } else {
                                    that.$message.error('未获取到订单信息，可联系开发人员')
                                }
                            },
                            complete: function (XMLHttpRequest) {
                                requestPretreatment(XMLHttpRequest);
                            },
                            dataType: "json"
                        });
                    } 
                }).catch(() => { });
            } else if (command == "false") {//拒绝
                //1.拒绝原因
                this.$prompt('请填写拒绝原因?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    inputPattern: /^(?!\s*$).+/,
                    inputErrorMessage: '请输入拒绝原因',
                    type: 'warning',
                }).then(({ value }) => {
                    that.dialogVisible = false;
                    $.ajax({//查询
                        headers: requestHeaders(),
                        url: `${BASE_URL2}/member/getMemberPoint`,
                        type: 'POST',
                        data: {
                            Data: JSON.stringify([{
                                tableName: 'business_refund',
                                Condition: window.btoa(unescape(encodeURIComponent("Refund_SerialNumber='" + row.Refund_SerialNumber + "'"))),
                            }, {
                                tableName: 'business_sales_order_detail',
                                Condition: window.btoa(unescape(encodeURIComponent("Sales_Order_Detail_SerialNumber='" + row.Sales_Order_Detail_SerialNumber + "'"))),
                            }]),
                        },
                        success: function ({ business_refund, business_sales_order_detail }) {
                            if (business_refund.length == 1 && business_sales_order_detail.length == 1) {
                                let Row_Status = business_refund[0].Row_Status;
                                let Refund_Type = business_sales_order_detail[0].Refund_Type;
                                if (row.Row_Status.charAt(1)=='5') {//已退货
                                    business_refund[0].Row_Status = Row_Status.charAt(0) + '6';
                                }else{//未退货
                                    business_refund[0].Row_Status = Row_Status.charAt(0) + '2';
                                }
                                business_refund[0].Cause = value;
                                business_sales_order_detail[0].Refund_Type = Refund_Type.charAt(0) + '2';
                                let data = {
                                    Data: JSON.stringify({ Modify: { business_sales_order_detail, business_refund, } })
                                }
                                //拒绝回写
                                $.ajax({
                                    headers: requestHeaders(),
                                    url: `${BASE_URL2}/generalBusiness/generalSave`,
                                    type: 'POST',
                                    data,
                                    success: function (res) {
                                        if (res.Status == "success") {
                                            that.$message({
                                                type: 'success',
                                                message: '已拒绝退款'
                                            });
                                            that.getList(that.form);
                                        }
                                    },
                                    complete: function (XMLHttpRequest) {
                                        requestPretreatment(XMLHttpRequest)
                                    },
                                    dataType: "json"
                                })
                            } else {
                                that.$message.error('未获取到订单信息，可联系开发人员')
                            }
                        },
                        complete: function (XMLHttpRequest) {
                            requestPretreatment(XMLHttpRequest);
                        },
                        dataType: "json"
                    });
                }).catch(() => { })
            } else if (command == "show") {
                that.Sales_Order = row;
                that.dialogVisible = true;
            } else if (command == "return") {//退货退款，确认已退货
                this.$confirm('确认，是否已收到用户退回货物?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning',
                }).then(() => {
                    that.dialogVisible = false;
                    $.ajax({//查询
                        headers: requestHeaders(),
                        url: `${BASE_URL2}/generalBusiness/generalQueryByTableNameWithOriginal`,
                        type: 'POST',
                        data: {
                            Data: "business_refund",
                            Condition: "Refund_SerialNumber='" + row.Refund_SerialNumber + "'"
                        },
                        success: function (business_refund) {
                            if (business_refund.length == 1) {
                                let Row_Status = business_refund[0].Row_Status;
                                business_refund[0].Row_Status = Row_Status.charAt(0) + '5';
                                let data = {
                                    Data: JSON.stringify({ Modify: { business_refund } })
                                }
                                $.ajax({
                                    headers: requestHeaders(),
                                    url: `${BASE_URL2}/generalBusiness/generalSave`,
                                    type: 'POST',
                                    data,
                                    success: function (res) {
                                        if (res.Status == "success") {
                                            that.$message({
                                                type: 'success',
                                                message: '确认成功'
                                            });
                                            that.getList(that.form);
                                        }
                                    },
                                    complete: function (XMLHttpRequest) {
                                        requestPretreatment(XMLHttpRequest)
                                    },
                                    dataType: "json"
                                })
                            } else {
                                that.$message.error('未获取到订单信息，可联系开发人员')
                            }
                        },
                        complete: function (XMLHttpRequest) {
                            requestPretreatment(XMLHttpRequest);
                        },
                        dataType: "json"
                    });
                }).catch(() => { })
            }
        },
        Export(form) {
            const that = this;
            this.loading = true;
            let data = deepClone(form);
            data.Condition = window.btoa(unescape(encodeURIComponent("%" + data.Sales_Order_SerialNumber + "%,%" + data.Sales_Order_SerialNumber + "%")))
            let sql = "";
            if (data.Submit_Date) {
                sql = sql + "AND business_refund_detail.Submit_Date BETWEEN '" + data.Submit_Date[0] + "' AND '" + data.Submit_Date[1] + "'\r\n"
            }
            if (data.Supplier_SerialNumber) {
                sql = sql + "AND business_sales_order_detail.Supplier_SerialNumber = '" + data.Supplier_SerialNumber + "'\r\n"
            }
            data.ExtensionCondition = window.btoa(unescape(encodeURIComponent(sql)));
            $.ajax({
                headers: requestHeaders(),
                url: `${BASE_URL2}/generalBusiness/generalQueryBySQLSerialNumber`,
                type: 'POST',
                data,
                success: function (Result) {
                    if (Result.length > 0) {
                        that.ExportData = Result;
                        that.$nextTick(() => {
                            let wb = XLSX.utils.table_to_book(document.querySelector("#ExportData"));
                            var wbout = XLSX.write(wb, {
                                bookType: "xlsx",
                                bookSST: true,
                                type: "array"
                            });
                            try {
                                saveAs(
                                    new Blob([wbout], {
                                        type: "application/octet-stream"
                                    }),
                                    "销售订单表" + (+new Date()) + ".xlsx"
                                );
                            } catch (e) {
                                if (typeof console !== "undefined") console.log(e, wbout);
                            }
                            that.$message({
                                message: '已成功导出',
                                type: 'success'
                            })
                            return wbout;
                        })
                    } else {
                        that.$message({
                            message: '暂无可导出的数据',
                            type: 'warning'
                        })
                    }
                },
                complete: function (XMLHttpRequest) {
                    that.loading = false;
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json"
            });
        }
    },
})